home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / gsdbloo.exe / DEMOU001.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-20  |  1KB  |  57 lines

  1. program DemoU001;
  2. {------------------------------------------------------------------------------
  3.                                DBase File Maker
  4.                                Useless Examples
  5.                                  Demo Program
  6.  
  7.        Copyright (c)  Richard F. Griffin
  8.  
  9.        10 February 1992
  10.  
  11.        102 Molded Stone Pl
  12.        Warner Robins, GA  31088
  13.  
  14.        -------------------------------------------------------------
  15.  
  16.        Demonstrates the use of GS_DB3Build to create a dBase file.  A
  17.        file 'MYFILE.DBF' will be created.
  18.  
  19. -------------------------------------------------------------------------------}
  20.  
  21. uses
  22.    GS_Strng,
  23.    GS_dBase,
  24.    GS_dB3Wk;
  25.  
  26. type
  27.    FldRecPtr   = ^FldRecTyp;
  28.    FldRecTyp   = array[1..GS_dBase_MaxRecField] of GS_dBase_Field;
  29.  
  30. var
  31.    f : FldRecPtr;
  32.    t : string;
  33.    FLoc : integer;
  34.  
  35. procedure InsertField(s : string; t : char; l,d : integer);
  36. begin
  37.    if FLoc >= GS_dBase_MaxRecField then exit;
  38.    inc(FLoc);
  39.    s := AllCaps(s);
  40.    CnvStrToAsc(s,f^[FLoc].FieldName,11);
  41.    f^[FLoc].FieldType := t;
  42.    f^[FLoc].FieldLen := l;
  43.    f^[FLoc].FieldDec := d;
  44.    f^[FLoc].FieldAddress := 0;
  45.    FillChar(f^[FLoc].Reserved,20,#0);
  46. end;
  47.  
  48. begin
  49.    New(f);
  50.    FLoc := 0;
  51.    InsertField('FIELD1','C',8,0);
  52.    InsertField('SECOND','D',8,0);
  53.    InsertField('THIRD','L',1,0);
  54.    InsertField('FOURTH','N',6,2);
  55.    GS_dB3_Build('MYFILE',f,FLoc);
  56. end.
  57.